<ResourceDictionary
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    xmlns:local="clr-namespace:QuickZip.UserControls"        
    xmlns:conv="http://www.quickzip.org/Converters"
    xmlns:scm="clr-namespace:System.ComponentModel;assembly=System"
    xmlns:dat="clr-namespace:System.Windows.Data;assembly=PresentationFramework"
    >
    <ResourceDictionary.MergedDictionaries>
        <ResourceDictionary Source="pack://application:,,,/QuickZip.UserControls;component/Themes/Converters.xaml" />
        <ResourceDictionary Source="pack://application:,,,/QuickZip.UserControls;component/Themes/Brushes.xaml" />
        <ResourceDictionary Source="pack://application:,,,/QuickZip.UserControls;component/Themes/Geometry.xaml" />
        <ResourceDictionary Source="pack://application:,,,/QuickZip.UserControls;component/Themes/Templates.xaml" />

    </ResourceDictionary.MergedDictionaries>

    <Style x:Key="{x:Type local:PreviewPanelBase}" TargetType="{x:Type local:PreviewPanelBase}"                     
           >
        <Setter Property="ItemsPanel">
            <Setter.Value>
                <ItemsPanelTemplate>
                    <local:VirtualStackPanel Orientation="Horizontal" IsItemsHost="True"
                                          ItemWidth="{Binding Height, 
                                RelativeSource={RelativeSource Mode=FindAncestor, 
                                        AncestorType={x:Type local:PreviewPanelBase}}}"
                                          ItemHeight="{Binding Height, 
                                RelativeSource={RelativeSource Mode=FindAncestor, 
                                        AncestorType={x:Type local:PreviewPanelBase}}}"
                                CacheItemCount="1"
                                          />
                </ItemsPanelTemplate>
            </Setter.Value>
        </Setter>
        <Setter Property="Template">
            <Setter.Value>
                <ControlTemplate TargetType="{x:Type local:PreviewPanelBase}" >
                    <ControlTemplate.Resources>
                        <Style x:Key="BaseButtonStyle" TargetType="Button">
                            <Style.Setters>
                                <Setter Property="VerticalContentAlignment" Value="Center" />
                                <Setter Property="Template">
                                    <Setter.Value>
                                        <ControlTemplate TargetType="{x:Type ButtonBase}">
                                            <Border x:Name="border"
                                                Padding="10,0"
				                                Background="Transparent" 
				                                BorderBrush="Transparent"
                                                BorderThickness="1"				
				                                SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}">
                                                <ContentPresenter HorizontalAlignment="{TemplateBinding HorizontalAlignment}" 
                                                    VerticalAlignment="Stretch" />
                                            </Border>
                                            <ControlTemplate.Triggers>
                                                <Trigger Property="IsMouseOver" Value="True">
                                                    <Setter Property="Background" Value="White" />
                                                    <!--<Setter TargetName="border" Property="BorderBrush" Value="{StaticResource NormalBorderBrush}" />-->
                                                </Trigger>
                                                <Trigger Property="IsEnabled" Value="False">
                                                    <Setter Property="Background" Value="DarkGray" />
                                                </Trigger>
                                            </ControlTemplate.Triggers>
                                        </ControlTemplate>
                                    </Setter.Value>
                                </Setter>
                            </Style.Setters>
                        </Style>

                        <Style x:Key="arrowPathStyle" TargetType="{x:Type Path}">
                            <Setter Property="Fill" Value="{Binding Background, 
                                RelativeSource={RelativeSource Mode=FindAncestor, AncestorType={x:Type Button}}}" />
                            <Setter Property="Stroke" Value="{StaticResource DefaultedBorderBrush}" />
                            <Setter Property="StrokeThickness" Value="0.5" />
                            <Setter Property="Stretch" Value="Fill" />
                            <Setter Property="HorizontalAlignment" Value="Center" />
                            <Setter Property="Width" Value="10" />
                            <Setter Property="Height" Value="10" />
                            <Setter Property="LayoutTransform">
                                <Setter.Value>
                                    <ScaleTransform ScaleX="0.8" ScaleY="1.2" />
                                </Setter.Value>
                            </Setter>
                        </Style>
                        <Style x:Key="smallArrowPathStyle" TargetType="{x:Type Path}" BasedOn="{StaticResource arrowPathStyle}">
                            <Setter Property="Width" Value="8" />
                            <Setter Property="Height" Value="8" />
                            <Setter Property="Margin" Value="0" />                            
                        </Style>
                        <Style x:Key="verticalLinePathStyle" TargetType="{x:Type Path}" BasedOn="{StaticResource arrowPathStyle}">
                            <Setter Property="Width" Value="4" />
                            <Setter Property="Height" Value="8" />
                            <Setter Property="Margin" Value="0" />
                            <!--<Setter Property="StrokeThickness" Value="1" />-->
                        </Style>                        
                        <!--<Path Data="{StaticResource ReversedNormalArrow}" 
                                  Fill="{Binding Background, ElementName=PART_LeftNavButton}" Stretch="Fill"
                                  Stroke="{StaticResource DefaultedBorderBrush}" StrokeThickness="0.5" 
                                  HorizontalAlignment="Center"
                                                    Width="10" Height="10"                                   
                                                    />-->
                    </ControlTemplate.Resources>
                    <Grid>
                        <Grid.ColumnDefinitions>
                            <ColumnDefinition Width="Auto" />
                            <ColumnDefinition Width="*" />
                            <ColumnDefinition Width="Auto" />
                        </Grid.ColumnDefinitions>
                        <Grid.RowDefinitions>
                            <RowDefinition Height="*" />
                            <RowDefinition Height="*" />
                        </Grid.RowDefinitions>
                        <Button x:Name="PART_LeftNavButton" Grid.Column="0" Grid.Row="0" Command="MoveToPageUp" 
                                Style="{StaticResource BaseButtonStyle}" >
                            <StackPanel Orientation="Horizontal" >
                                <Path Data="{StaticResource ReversedNormalArrow}" Style="{StaticResource arrowPathStyle}" />
                                <Path Data="{StaticResource ReversedNormalArrow}" Style="{StaticResource arrowPathStyle}" />
                            </StackPanel>
                        </Button>
                        <Button x:Name="PART_RightNavButton" Grid.Column="2" Grid.Row="0" Command="MoveToPageDown" 
                                Style="{StaticResource BaseButtonStyle}" >
                            <StackPanel Orientation="Horizontal" >                                
                                <Path Data="{StaticResource NormalArrow}" Style="{StaticResource arrowPathStyle}" />
                                <Path Data="{StaticResource NormalArrow}" Style="{StaticResource arrowPathStyle}" />
                            </StackPanel>
                        </Button>

                        <Button x:Name="PART_GoFirstButton" Grid.Column="0" Grid.Row="1" Command="MoveToHome" 
                                Style="{StaticResource BaseButtonStyle}" >
                            <StackPanel Orientation="Horizontal" >
                                <Path Data="{StaticResource verticalLine}" Style="{StaticResource verticalLinePathStyle}" />
                                <Path Data="{StaticResource ReversedNormalArrow}" Style="{StaticResource smallArrowPathStyle}" />
                                <Path Data="{StaticResource ReversedNormalArrow}" Style="{StaticResource smallArrowPathStyle}" />
                            </StackPanel>
                        </Button>
                        <Button x:Name="PART_GoLastButton" Grid.Column="2" Grid.Row="1" Command="MoveToEnd" 
                                Style="{StaticResource BaseButtonStyle}" >
                            <StackPanel Orientation="Horizontal" >
                                <Path Data="{StaticResource NormalArrow}" Style="{StaticResource smallArrowPathStyle}" />
                                <Path Data="{StaticResource NormalArrow}" Style="{StaticResource smallArrowPathStyle}" />
                                <Path Data="{StaticResource verticalLine}" Style="{StaticResource verticalLinePathStyle}" />
                            </StackPanel>
                        </Button>

                        <ScrollViewer CanContentScroll="False"  x:Name="PART_ScrollViewer"
                                      Grid.Column="1" Grid.RowSpan="2"
                                  HorizontalScrollBarVisibility="Disabled"
                                  VerticalScrollBarVisibility="Disabled"
                                  IsDeferredScrollingEnabled="True">
                            <ItemsPresenter />
                        </ScrollViewer>

                    </Grid>
                </ControlTemplate>
            </Setter.Value>
        </Setter>

    </Style>



</ResourceDictionary>
